package com.atguigu.tingshu.search.config;

import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.concurrent.ThreadPoolExecutor;

@Component
public class ThreadLocalExecutorConfig {
    @Bean
    public ThreadPoolExecutor threadPoolExecutor(){
        //获取系统cpu核数
        int corePoolSize = Runtime.getRuntime().availableProcessors();

        return new ThreadPoolExecutor(corePoolSize,10,60,
                java.util.concurrent.TimeUnit.SECONDS,
                new java.util.concurrent.ArrayBlockingQueue<>(1000));
    }

}



